# Importing Data
ICELAND<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "Q1:Q229")

# Checking the Imported Data
View(ICELAND)
# Creating Time Series Data
ICELAND_ts <- ts(ICELAND, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
ICELAND_ts
sum(is.na(ICELAND_ts))
library(forecast)
ICELAND_ts <- tsclean(ICELAND_ts)
ICELAND_ts

# Identification: Plotting the Time Series Data
plot(ICELAND_ts)

# Estimating the appropriate model
ICELAND_ts_model <- auto.arima(ICELAND_ts)
ICELAND_ts_model

# Forecasting
options(max.print=1000000)
ICELAND_ts_forecast <- forecast (ICELAND_ts_model, level=c(95), h=288)
plot(ICELAND_ts_forecast)
ICELAND_ts_forecast             

# Exporting
write.table(ICELAND_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/ICELAND_TSA.csv", sep=",")
